package argtrust.util;


public class Pair<F, S> {

    F _first;
    S _second;

    public Pair(F first, S second) {

        _first = first;
        _second = second;
    }

   public  F getFirst() {
        return _first;
    }

   public  S getSecond() {
        return _second;
    }
    private int hashCode = 0;

    @Override
    public int hashCode() {
        if (0 == hashCode) {
            hashCode = 17;
            hashCode = 37 * hashCode + _first.hashCode();
            hashCode = 37 * hashCode + _second.hashCode();
        }
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Pair rhs = (Pair) obj;
        boolean res = true;
        if (_first != null) {
            res = res && _first.equals(rhs._first);
        } else {
            res = res && rhs._first == null;
        }
        if (_second != null) {
            res = res && _second.equals(rhs._second);
        } else {
            res = res && _second == null;
        }
        return res;
    }
}
